import fix_path

from google.appengine.ext import webapp, deferred
from google.appengine.ext.webapp.util import run_wsgi_app 

from compact import *

import logging

class StatCompact(webapp.RequestHandler): 
    def get(self): 
        self.response.headers['Content-Type'] = 'text/html' 
        compactor = StatCompactor()
        logging.info("StatCompactor start  = %s" % (str(compactor)))
        deferred.defer(compactor.run,50,100)
        logging.info("StatCompactor end  = %s" % (str(compactor)))
        pass


class Other(webapp.RequestHandler): 
    def get(self): 
        pass


application = webapp.WSGIApplication([('/compactor/compactstat.*', StatCompact),
                                      ('/compactor/.*', Other)], debug=True) 

def main(): 
     run_wsgi_app(application) 

if __name__ == '__main__': 
     main() 